SetAxisCam

連結軸並開始凸輪運動。

語法

KsCommandStatus SetAxisCam(
     int Master,
     int Slave,
     BOOL Permanent,
     double MasterOffset,
     double SlaveOffset,
     double MasterScaling,
     double SlaveScaling,
     McCamStartMode StartMode,
     double StartParameter,
     McSource MasterValueSource,
     int Cam,
     McBufferMode BufferMode
);

參數

Master [in]:主軸索引。索引以零為起點;別名將影響此參數。

Slave [in]:從軸索引。索引以零為起點;別名將影響此參數。從軸之最大數量為 32 軸。

Permanent [in]:決定馬達停用後是否保留凸輪狀態。

TRUE:馬達停用但保留凸輪狀態,例如當主軸啟用時從軸也會跟著啟用,而當主軸發生錯誤從軸也會發生錯誤。

FALSE:馬達停用後不會保留凸輪狀態。

MasterOffset [in]:凸輪表中主軸位置的偏移量。

SlaveOffset [in]:凸輪表中從軸位置的偏移量。

MasterScaling [in]:主設定檔因子(預設值 = 1.0),以從軸的角度來看,該因子乘以整個主設定檔。

SlaveScaling [in]:從設定檔因子(預設值 = 1.0),該因子乘以整個從設定檔。

StartMode [in]:從軸所用的凸輪模式。請見 McCamStartMode 類型

StartParameter [in]:依選擇的斜坡而定,若為 camRampDistanceStartParameter 即為從軸移動的距離,單位為計數;若為 camRampTimeStartParameter 即為從軸移動的時間,每秒為一單位。該參數使用主軸的資訊來決定如何移動從軸,而距離取決於主軸移動的距離。

MasterValueSource [in]:定義同步的來源。請見 McSource 類型

Cam [in]:凸輪表的索引,連接到 SetCamTable 的輸出。 .

BufferMode [in]:定義如何融合兩功能的速度,請見 McBufferMode 類型

回傳值

返回 KsCommandStatus 結構。

備註

範例

KsCommandStatus AssignCamSlave(INT Master, INT Slave, INT Table) {
   BOOL InSync = FALSE;
   BOOL Busy = FALSE;
   BOOL Active = FALSE;
   BOOL CommandAborted = FALSE;
   BOOL Error = FALSE;
   WORD ErrorId = 0;
   INT QueueIndex = -1;
   BOOL EndOfProfile = FALSE;
   KsCommandStatus cam = SetAxisCam(Master, Slave, FALSE,
      0, //Master Offset. Offset to add to the master positions in the CAM table
      0, //Slave Offset. Offset to add to the slave positions in the CAM table
      1, /*Master Scaling. Ratio to apply to the distance between 
           the master positions and the original position*/
      1, //Slave Scaling. Ratio to apply to the slave positions in the CAM table
      camRelative, //StartMode. 
         /*Absolute: The slave axis will jump to its target in the table.
           Alarms may be triggered if the position is too far.*/
         //Relative: The current master/slave positions are used as origin for the CAM table.
         /*Ramp Distance: The slave axis will ramp to its target position
           while the master axis moves along the distance provided in StartParameter*/
         /*Ramp Time: The slave axis will ramp to its target position
           over the period of time provided in seconds in StartParameter*/
      0, //Start Parameter 
      mcSetValue, /*Master Value Source. Value of the master position used.
                    Cam be the target position (commanded value and set value are identical)
                    or the actual position.*/
      Table,
      mcAborting
   );
   return cam;
}

使用需求

  RT Win32
最低支援版本 4.0 4.0
標頭檔 ksmotion.h ksmotion.h
程式庫 KsApi_Rtss.lib KsApi.lib

參見

GetAxisCamInfo

GetCamTable

PowerAxis

ReleaseAxis

SetCamTable

SimulateAxisCam

StopAxis